<template>
  <div class="app-container">
    <el-dialog title="选择PRD"  :visible="visible" @close="cancel" width="1200px"
         :close-on-click-modal="false" :close-on-press-escape="false"
          append-to-body>

          <el-form :model="queryParams" ref="queryForm" size="small"  :inline="true"   label-width="100px">
            <el-form-item label="产品名称"  prop="productName">
              <el-input v-model.trim="queryParams.productName"  placeholder="请输入产品名称" clearable
                @keyup.enter.native="handleGetPRDList" />
            </el-form-item>
            <el-form-item label="PRD OA编号" prop="prdOaNo">
              <el-input v-model.trim="queryParams.prdOaNo"   placeholder="请输入PRD OA编号" clearable
                @keyup.enter.native="handleGetPRDList" />
            </el-form-item>
             
      
            <el-form-item>
              <el-button type="primary" icon="el-icon-search" size="mini" @click="handleGetPRDList">搜索</el-button>
              <el-button icon="el-icon-refresh" size="mini" @click="reset">重置</el-button>
            </el-form-item>
          </el-form>

          <el-table border v-loading="loading" :data="tableData" @row-click="handleCurrentChange">
            <el-table-column label="选择" width="80">
              <template slot-scope="scope">
                  <el-radio class="radio" :label="scope.row.prdOaId" >{{""}}</el-radio>
              </template>
            </el-table-column>
            <el-table-column label="产品名称" align="center" prop="productName"/>
            <el-table-column label="PRD OA单号" align="center" prop="prdOaNo" width="150"/>
            <el-table-column label="MRD OA单号" align="center" prop="mrdOaNo" width="150"/>
            <el-table-column label="项目编码" align="left"  width="150"  prop="projectNo"/>
            <el-table-column label="项目名称" align="center" prop="projectName" width="150"/>
            <el-table-column label="项目等级" align="center" prop="level"  width="100"/> 
            <el-table-column label="提交人" align="center" prop="submitName"  width="100"/>
             <!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="80">
              <template slot-scope="scope">
                 <el-button size="mini" type="text"   icon="el-icon-position"  @click="handleCreateOA(scope.row)" >选中</el-button> 
              </template>
            </el-table-column> -->
          </el-table>
          <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
              @pagination="handleGetPRDList" />
          <span slot="footer" class="dialog-footer" > 
            <el-button  @click="cancel">取 消</el-button>
          </span>
    </el-dialog>
 
  </div>
</template>

<script>
  import {queryPRDList,queryPRDUserList}  from "@/api/oa/oa";

  export default {
  name: "PRDList",
  data() {
      return {
         // 总条数
        total: 0,
        //表格loading  
        loading:false,
        //弹框是否可见
        visible:false,
        //表格数据
        tableData: [],
        //OA表单提交人列表
        submitUserList:[],
        //查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 3,
          mrdOaNo:null,
          prdOaNo:null,
          userNo:null
        }
      }
  },
  created() {
    
  },
  methods: {


    //选中当前行
    handleCurrentChange(row){
      this.visible = false;
      this.queryParams = {};
      this.$emit('ok', row);
    },


    //查询提交人列表
    handelSubmitUserList(){
      queryPRDUserList().then(response=>{
          this.submitUserList = response.data;
      })
       
    },
    
    //获取PRD 流程列表
    handleGetPRDList(){
      this.loading = true;
      queryPRDList(this.queryParams).then(response =>{
          this.tableData = response.rows;
          this.loading = false;
      })


    },


    
    //弹出
     open(){
        this.visible = true;
        this.handelSubmitUserList();
        this.handleGetPRDList();
     },
     //查询事件重置
     reset(){
      this.queryParams = {};
     },

     // 取消按钮
     cancel() {
        this.visible = false;
        this.reset();
        this.tableData = [];  
     }
  }
};
</script>
 
 
